<?php
	$pid = Yii::app()->request->getParam('pid');
?>

<script type="text/javascript">
	function showNewCategory(cateVal) {
		if (cateVal == "-" )
			$("#addNewCategory").show();
		else
			$("#addNewCategory").hide();
	}
	$(document).ready(function(){
			
		
		$("#selectCategory").change(function(){
			if($(this).val() == 3)
				$("#addNewCategory").show();
			else $("#addNewCategory").hide();
			});
		
	
		$("#selectAll").click(function(){
			$(".messageCheck").attr("checked", "checked");
			
			return false;
			});
		$("#selectNone").click(function(){
			$(".messageCheck").removeAttr("checked");
			return false;
			});
	});
</script>
<div class="clear"></div>
<link rel="stylesheet" type="text/css"
	href="<?php echo Yii::app()->theme->baseUrl; ?>/css/message.css" />

<div id="than"><img src="<?php echo Html::imageUrl("muiten.png");?>"
	width="27" height="26" ;"" style="float: left">
<div id="textxanhdam">Messages</div>
</div>
<div class="padding15"></div>
<!-- Begin leftSidebar-->
<div id="leftSidebar"><!-- End leftSidebar --></div>

<!-- Begin rightSidebar -->
<div id="rightSidebar">
                	<?php $form = $this->beginWidget('CActiveForm');?>
                	<div id="rightHeader">
<h2>Post a new message
<h2>

</div>
<div id="rightWrapper">
<div id="addMessageWrapper">
<div id="addMessageBorder">Subject <font color="red">*</font>
<div class="padding5"></div>
									<?php echo $form->textField($message,'message_subject')?>
									<div class="padding15"></div>
Choose a category
<div class="padding5"></div>
									<?php echo $form->dropDownList($message,
																   	'message_category_id',
																	$message->getListCategory($pid),
																	array(
																		'onClick'=>'showNewCategory($(this).val())',
																	)
									);?>
									<div class="padding15"></div>
<div id="addNewCategory" style="display: none; margin-left:20px;">
										New Category <font color="red">*</font>
										<div class="padding5"></div>

										<?php echo $form->textField($messageCate,'message_category_name',array(
											'size'=>80,
										))?>
										<?php echo $form->error($messageCate,'message_category_name');?>
										<div class="padding10"></div>
										<p>Category Description</p>
										<?php echo $form->textArea($messageCate,'message_category_description',array(
											'rows'=>'4',
											'cols'=>'70',
										))?>
										<?php echo $form->error($messageCate,'message_category_description');?>
 
										<div class="padding15"></div>
</div>

Type your messages <font color="red">*</font>
<div class="padding5"></div>
									<?php echo $form->textArea($message,'message_content',array('cols'=>90,'rows'=>6))?>
									<?php echo $form->error($message,'message_content')?>
									<div class="padding20"></div>
Send to:(<a id="selectAll" href="">select all</a> | <a id="selectNone"
	href="">select none</a>)
<div class="padding5"></div>
<div id="addMessageGroup" style="margin-left: 10px;">
	<?php echo CHtml::checkBoxList('message_user','null',$message->getListUser($pid),array('class'=>'messageCheck'))?>
</div>
<div class="padding20"></div>
<div id="postMessage"><input type="submit" value="Post this message"></input>
or <a
	href="<?php echo Yii::app()->controller->createUrl("/messages/index/",array('pid'=>$pid));?>"
	class="messageCancel">Cancel</a></div>
<script type="text/javascript">
									$(document).ready(function(){
										$("#selectCategory").change(function(){
											if($(this).val() == 3)
												$("#addNewCategory").show();
											else $("#addNewCategory").hide();
											});
										
									
										$("#selectAll").click(function(){
											$(".messageCheck").attr("checked", "checked");
											
											return false;
											});
										$("#selectNone").click(function(){
											$(".messageCheck").removeAttr("checked");
											return false;
											});
									});
									
								</script></div>
</div>
</div>		
				<?php $this->endWidget();?>			
				<!-- End right sidebar --></div>

	width="145" height="48" border="0"
	style="float: right; margin-top: 20px;"></a>
</div>